function ModuleUpload(doc, container, width, height, operator, now, options) {
  this._doc = doc;
  this._container = container;
  this._width = width;
  this._height = height;
  this._operator = operator;
  this._now = now;
  this._options = options;

  this._callbackFunc = (options && options.callbackFunc) ? options.callbackFunc : null;
  this._dirId = (options && options.dirId) ? options.dirId : 0;
  this._popupBox = (options && options.popupBox) ? options.popupBox : null;
  this._createElements();
}

ModuleUpload.prototype._createElements = function() {
  var _self = this;
  this._gui = new Upload(this._doc, this._container, this._width, this._height, this._operator, this._now, this._options)._gui;
  this._uploaded = [];
  
  DOMUtils.removeChildElements(this._gui.uploaded);
  DOMUtils.removeChildElements(this._gui.uploading);
  DOMUtils.removeChildElements(this._gui.upload);
  
  this._gui.containerUploading.style.display = 'none';
  this._gui.containerUploading.style.marginTop = (60 - this._height ) + 'px';
  
  this._gui.containerBrowse.style.position = 'relative';
  this._gui.containerBrowse.style.zIndex = 2;
  
  
  var span = this._doc.createElement('span');
  span.id = UploadUtils._defaultButtonPlaceholderId;
  this._gui.upload.appendChild(span);
  
  var cancel = this._doc.createElement('span');
  cancel.id = UploadUtils._defaultCancelButtonId;
  this._gui.upload.appendChild(cancel);

  var itr = this._gui.uploading.insertRow(-1);
  itd = itr.insertCell(-1);
  itd.id = UploadUtils._defaultProgressTargetId;
  
  var func = function(file, result) { var file = result;
                                      file.trackId = MiscUtils.unique();
                                      file.customerTrackId = _self._operator.trackId;
                                      file.parentDirId = _self._dirId;
                                      new RequestUtils()._custom('uploadFile', { file: file }, function(result, params) { if (result) {
                                                                                                                            _self._uploaded[_self._uploaded.length] = result;
                                                                                                                            _self._updateElements.call(_self);
                                                                                                                          }
                                                                                                                        }, null);
                                    };
  var uu = new UploadUtils();
  uu._fileTypes = '*.*';
  uu._fileTypesDescription = 'Files';
  uu._buttonImageUrl = 'image/upload/browse.png';
  uu._buttonWidth = '124px';
  uu._buttonHeight = '39px';
  uu._unUploadDivId = this._gui.containerBrowse.id;
  uu._uploadedDivId = this._gui.containerUploading.id;
  uu._createInstance(JSON.stringify(this._operator.account), false, func);
  
  this._updateElements();
};

ModuleUpload.prototype._updateElements = function() {
  var _self = this, tr, td;
  DOMUtils.removeChildElements(this._gui.uploaded);
  
  this._popupBox._gui.close.onclick = function() { _self._popupBox._close();
                                                   if (_self._uploaded.length != 0) {
                                                     _self._callbackFunc();
                                                   }
                                                 };
  tr = this._gui.uploaded.insertRow(-1);
  td = tr.insertCell(-1);
  td.align = 'left';
  td.style.verticalAlign = 'top';
  td.style.height = '75px';
  var table = this._doc.createElement('table');
  table.cellPadding = 0;
  table.cellSpacing = 0;
  table.style.width = '80px';
  table.style.height = '75px';
  td.appendChild(table);
  for (var i = 0, il = this._uploaded.length; i < il; i++) {
    var file = this._uploaded[i];
    
    var itable = this._doc.createElement('table');
    itable.cellPadding = 0;
    itable.cellSpacing = 0;
    itable.style.width = '80px';
    itable.style.height = '75px';
    
    if (table.rows.length == 0)  {
      itd = table.insertRow(-1).insertCell(-1).appendChild(itable);
    } else if (table.rows[table.rows.length - 1].cells.length < 5) {
      itd = table.rows[table.rows.length - 1].insertCell(-1).appendChild(itable);
    } else {
      itd = table.insertRow(-1).insertCell(-1).appendChild(itable);
    }
    
    itd.align = 'center';
    new ModuleViewFile(this._doc, itd, null, null, this._operator, this._now, { item: file } );
  }
};
